set( NACL                       ON )

set( PLATFORM_EMBEDDED          ON )
set( PLATFORM_NAME              "NaCl" )
set( PLATFORM_TRIPLET           "x86_64-nacl" )
set( PLATFORM_PREFIX            "$ENV{NACL_SDK_ROOT}/toolchain/linux_x86_newlib" )
set( PLATFORM_PORTS_PREFIX      "${CMAKE_SOURCE_DIR}/ports/NaCl-x86_64" )
set( PLATFORM_EXE_SUFFIX        ".x86_64.nexe" )

set( CMAKE_SYSTEM_NAME          "Linux" CACHE STRING "Target system." )
set( CMAKE_SYSTEM_PROCESSOR     "x86_64" CACHE STRING "Target processor." )
set( CMAKE_FIND_ROOT_PATH       "${PLATFORM_PORTS_PREFIX};${PLATFORM_PREFIX}/x86_64-nacl" )
set( CMAKE_C_COMPILER           "${PLATFORM_PREFIX}/bin/${PLATFORM_TRIPLET}-gcc" )
set( CMAKE_CXX_COMPILER         "${PLATFORM_PREFIX}/bin/${PLATFORM_TRIPLET}-g++" )
set( CMAKE_C_FLAGS              "-msse3" CACHE STRING "" )
set( CMAKE_CXX_FLAGS            "-msse3" CACHE STRING "" )
set( CMAKE_C_FLAGS_RELEASE      "-O3 -ffast-math" CACHE STRING "" )
set( CMAKE_CXX_FLAGS_RELEASE    "-O3 -ffast-math" CACHE STRING "" )

set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )

include_directories( SYSTEM $ENV{NACL_SDK_ROOT}/include )
link_directories( $ENV{NACL_SDK_ROOT}/lib/newlib_x86_64/Release )
